Comment.Timestamp Property

Gets or sets the point in time at which the comment was most recently changed.

Parent Type: Comment

Namespace: Microsoft.LearningComponents.DataModel

Assembly: Microsoft.LearningComponents.dll

Syntax
C#

public string Timestamp

{ get; set; }
Exceptions
Exception type Condition
InvalidOperationException

Thrown if this LearningDataModel object cannot be written to, or if this is a SCORM 1.2 package.

ArgumentOutOfRangeException

Thrown if the year is less than 1970 or greater than 2038.

FormatException

Thrown if the passed string is not in the correct format.

Remarks

In SCORM 2004, this corresponds to cmi.comments_from_learner.n.timestamp.

In SCORM 1.2, this is invalid.

This property indicates when the comment was created or most recently changed.

This field is a string in the same format as the SCORM specification for timestamps. This may be achieved easily within C# by code as shown in the example.

Example

C#
    // this saves the timestamp with the current timezone information
    session.CurrentActivityDataModel.CommentsFromLearner[0].Timestamp = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.ffzzz");
 
    // this saves a UTC timestamp, which is recommended to avoid issues with timezones
    session.CurrentActivityDataModel.CommentsFromLearner[0].Timestamp = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss.ffZ");
 
    // this saves timestamp with no specific timezone information
    session.CurrentActivityDataModel.CommentsFromLearner[0].Timestamp = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss");

If the value has not been set before it is accessed, null is returned.